# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.

# CMake lowest version requirement
cmake_minimum_required(VERSION 3.5.1)

# project information
project(opencann_test)

# Compile options
add_compile_options(-std=c++11)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../../../bin")
set(INC_PATH $ENV{DDK_PATH})
set(UTILS_PATH "../../common/src")

if (NOT DEFINED ENV{DDK_PATH})
    set(INC_PATH "/usr/local/Ascend/latest")
    message(STATUS "set default INC_PATH: ${INC_PATH}")
else ()
    message(STATUS "env INC_PATH: ${INC_PATH}")
endif()

#set(LIB_PATH $ENV{NPU_HOST_LIB})
set(LIB_PATH "$ENV{DDK_PATH}/compiler/lib64/stub/")
set(LIB_PATH_WHOLE "$ENV{DDK_PATH}/lib64/")

# Dynamic libraries in the stub directory can only be used for compilation
if (NOT DEFINED ENV{NPU_HOST_LIB})
    set(LIB_PATH "/usr/local/Ascend/acllib/lib64/stub/")
    message(STATUS "set default LIB_PATH: ${LIB_PATH}")
else ()
    message(STATUS "env LIB_PATH: ${LIB_PATH}")
endif()

message(STATUS "============================${LIB_PATH}====================")
# Header path
include_directories(
    ${INC_PATH}/include/
    ${INC_PATH}/compiler/include/graph/
    ${INC_PATH}/compiler/include/ge/
    ${INC_PATH}/compiler/include/parser/
    ${INC_PATH}/compiler/include/
    ${INC_PATH}/opp/built-in/op_proto/inc/
    ../../common/inc/
)

# add host lib path
link_directories(
    ${LIB_PATH}
    ${LIB_PATH_WHOLE}
)

message(STATUS "")

add_executable(graph_edit_001
        graph_edit_001.cpp)
target_link_libraries(graph_edit_001
        graph
	graph_base
        ge_compiler
        fmk_parser
        stdc++)
install(TARGETS graph_edit_001 DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})


add_executable(graph_edit_002
        graph_edit_002.cpp)
target_link_libraries(graph_edit_002
        graph
	graph_base
        ge_compiler
        fmk_parser
        stdc++)
install(TARGETS graph_edit_002 DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

add_executable(graph_edit_003
        graph_edit_003.cpp)
target_link_libraries(graph_edit_003
        graph
	graph_base
        ge_compiler
        fmk_parser
        stdc++)
install(TARGETS graph_edit_003 DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

add_executable(graph_edit_004
        graph_edit_004.cpp)
target_link_libraries(graph_edit_004
        graph
	graph_base
        ge_compiler
        fmk_parser
        stdc++)
install(TARGETS graph_edit_004 DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
